/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

import ads.graph.Graph;
import ads.graph.Graph.Node;
import ads.graph.Graph.Node.BFSData;
import ads.graph.GraphToolBox;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author framet-lap
 */
public class GraphTest {

    private Graph graph;

    public GraphTest() {
    }

    @BeforeClass
    public static void setUpClass() {
    }

    @AfterClass
    public static void tearDownClass() {
    }

    @Before
    public void setUp() {
        try {
            graph = GraphToolBox.createGraphWithFile("C:\\Users\\framet-lap\\Documents\\Studium\\ADS\\Svn\\trunk\\Exbox\\src\\ads\\graph\\graphInputFile");
        } catch (FileNotFoundException ex) {
            Logger.getLogger(GraphTest.class.getName()).log(Level.SEVERE, null, ex);
            assertTrue(false);
        } catch (IOException ex) {
            Logger.getLogger(GraphTest.class.getName()).log(Level.SEVERE, null, ex);
            assertTrue(false);
        }
    }

    @After
    public void tearDown() {
    }
    // TODO add test methods here.
    // The methods must be annotated with annotation @Test. For example:
    //

    @Test
    public void nodeCount() {
        System.out.println("getNodeCount:");
        System.out.println(graph.getNodeCount());
        System.out.println("---------");
    }

    @Test
    public void edgeCounte() {
        System.out.println("getEdgeCount:");
        System.out.println(graph.getEdgeCount());
        System.out.println("---------");
    }

    @Test
    public void getNodes() {
        System.out.println("getNodeNames:");
        System.out.println(graph.getNodeNames());
        System.out.println("---------");
    }

    @Test
    public void getEdges() {
        System.out.println("getEdgesFromNode Zürich:");
        System.out.println(graph.getEdgesFromNode("Zürich"));
        System.out.println("---------");
    }

    @Test
    public void bfs() {
        System.out.println("bfs Luzern:");
        HashMap<Node, BFSData> data = graph.getNode("Zürich").BFS();
        for (Node n : data.keySet()) {
            System.out.println("Node: " + n.getLabel());
            System.out.println("Level from RootNode: " + data.get(n).getLevel());
            System.out.println();
        }
        System.out.println("---------");
    }
}
